using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace MyHunter.New
{
    public partial class NewSite : Form
    {
        #region MEMBERS
        public EditMode EditMode;
        public string SiteName
        {
            get { return textBoxName.Text; }
        }
        public string SiteDescription
        {
            get { return textBoxDescription.Text; }
        }
        public string SiteIcon
        {
            get { 
                System.IO.Stream str = new System.IO.MemoryStream();
                //this.pictureBoxIcon.Image.Save(str, System.Drawing.Imaging.ImageFormat.Bmp); 

                return "";
            }
        }


	
        #endregion

        #region CTOR
        public NewSite(EditMode e, object toEdit)
        {
            InitializeComponent();
            EditMode = e;
            this.sitesBindingSource.DataSource = toEdit;
            if(EditMode == EditMode.New)
            {
                this.Text = "New Site";
                this.sitesBindingSource.AddNew();
            }
            else
            {
                this.Text = "Edit Site";
            }
        }
        #endregion

        #region EVENTS
        private void buttonSelectIcon_Click(object sender, EventArgs e)
        {
            if(this.openFileDialog.ShowDialog() == DialogResult.OK)
            {
                this.pictureBoxIcon.Load(this.openFileDialog.FileName);
            }
        }
        #endregion

        private void btnOK_Click(object sender, EventArgs e)
        {
            this.sitesBindingSource.EndEdit();
        }
    }
}